package Tpackage;

public class Window implements Runnable {
    private final Ticket ticket;

    public Window(Ticket ticket) {
        this.ticket = ticket;
    }
    public void run() {
        while (true) {
            ticket.sellTicket();
            if (ticket.getTickets() <= 0) break; // 当票数为0时，停止售票
        }
    }
}
